// pages/driver/sign/sign.js
const handler = require("../../../utils/function.js");
var app = getApp(),
  api = require("../../../api.js");
Page({

  /**
   * 页面的初始数据
   */
  data: {
    sign:''
  },
  //获取签名
  getSign:function(e){
    console.log(e)
    var sign=e.detail.value;
    this.setData({ sign})
  },
  getComplain:function(){
    let that=this;
    wx.showLoading({})
    app.request({
      url: api.user.signature,
      method: 'post',
      data: {
        signature: that.data.sign
      },
      success:function(res){
        wx.hideLoading()
        console.log(res)
        if(res.code==1){
          wx.showToast({
            title: res.msg,
            icon:'none',
            success:function(){
              wx.navigateBack({
                delta: 1
              })
            },
          })
          
        }else{
          wx.showToast({
            title: "请不好重复以前的签名",
            icon: 'none',
            success: function () {
              wx.navigateBack({
                delta: 1
              })
            },
          })
        }
      },
    })
  },
  /**
   * 
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },

  
})